#ifndef QMENUACTIONMAP_H
#define QMENUACTIONMAP_H

#include <QString>
#include <QAction>
#include <QList>
#include <QMap>

#include "core_global.h"

struct tagActionInfo
{
    QString     m_id;
    QAction     *m_action;
};

struct tagActionGroupInfo
{
    QString     m_id;
    QString     m_text;
    int         m_index;
    QList<tagActionInfo*>   m_actions;
};

class CORELIB_EXPORT QMenuActionMap
{
public:
    ~QMenuActionMap();
    void    insert_action(const QString &group,tagActionInfo* action,int index=-1);
    void    insert_group(const QString &id,const QString &text,int index);

    void    set_group_text(const QString &id,const QString &text);

    int     group_count();
    tagActionGroupInfo  *get_group(int index);
    tagActionInfo*      get_action(const QString &id);
protected:
    QList<tagActionGroupInfo*>  m_action_groups;
    QMap<QString,tagActionGroupInfo*>   m_id_to_group;
    QMap<QString,tagActionInfo*>        m_id_to_action;
};

#endif // QMENUACTIONMAP_H
